$(document).ready(function() {
	
	var dept_id = $('#dept_id').val();
	
	$.ajax({
		url : 'doctorProfile.do',
		data : 'dept_id='+dept_id ,
		dataType : "json",
		success : function(data) {
			
				$('.nav_information').append
				("<img src='resources/images/gr_navi_home.png'>&nbsp;&nbsp;>&nbsp;&nbsp;" +
						"의료진소개&nbsp;&nbsp;>&nbsp;&nbsp;"+data.doctorlist[0].deptname);
				
				var html2 = "";
				
				html2 += "<div id='medical_dept'>";
				html2 += data.doctorlist[0].deptname + "<img id='medical_image' src='resources/images/patient/medical_dept.png'>";
				html2 += "</div>";
				
				html2 += "<div id='welcome_dept'>";
				html2 += "메디컬 탑병원 "+ data.doctorlist[0].deptname +"에 오신걸 환영합니다";
				html2 += "</div>";
				$('#hospitalCategory').append(html2);
				
				
				var html = "";
				
				for (var i = 0; i < data.doctorlist.length; i++) {
					
					html+="<div class='doctor'>";
					html+="<div>";
					if(data.doctorlist[i].photo == null){
						html +="<img src='resources/images/doctorPicture.png' style='width:170px; height:200px;'></td>";
					}else{
						html +="<img src='resources/images/doctorimg/"+data.doctorlist[i].photo+"' style='width:170px; height:200px;'></td>";
					}
					html+="</div>";
					html+="<div id='info_name'>" + data.doctorlist[i].deptname+ " 의사 "+data.doctorlist[i].name+"</div>";
					html+="<div id='info' class='"+data.doctorlist[i].doctor_id+"'></div>";
					html+="</div>";
					
					$.ajax({
						url : 'doctorProfile2.do',
						data : "doctor_id="+data.doctorlist[i].doctor_id,
						dataType : 'json',
						success : function(data2){
							
							 for(i = 0; i < data2.doctorlist2.length; i++){
								 var list = data2.doctorlist2[i].detail_NAME + "&nbsp;&nbsp;";
								$("."+data2.doctorlist2[i].doctor_id).append(list);
								
							} 
						}
					}); 
				}
				
				$('#doctorProfile').append(html);
				
			}
		});
	});